﻿// Copyright (c) 2014 Jonathan Magnan (http://jonathanmagnan.com/).
// All rights reserved (http://zzzproject.com/sqlbulkcopy-extensions/).
// Licensed under MIT License (MIT) (https://zsqlbulkcopy.codeplex.com/license/).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#if NET35 || NET40
using System.Linq;

#elif NET20
using System.Collections.Generic;
using Z.Net.Legacy20;
#endif

namespace Z.Net.Extensions
{
    internal partial class SqlBulkOperation
    {
        public void SetSqlDeleteActionSingle()
        {
            StringBuilder sb; 
            IEnumerable<string> primaryKeysSelectList = Setting.PrimaryKeys.Select(x => string.Format("[{0}]" + "=" + "@{1}", x, ParameterMapping[x]));
            string sqlWhere = String.Join(" AND ", primaryKeysSelectList.ToArray());
 

            SqlActionBulk1 = string.Format(SqlDeleteActionSingle, SqlBulkCopy.DestinationTableName, TemporaryTableName, sqlWhere);
        }
    }
}